import { useState, useCallback } from 'react';

type ThemeColors = {
  primary: string;
  secondary: string;
  background: string;
  text: string;
};

type ThemeType = 'red' | 'yellow' | 'purple';

const themes: Record<ThemeType, ThemeColors> = {
  red: {
    primary: '#ff0000',
    secondary: '#ff6666',
    background: '#fff0f0',
    text: '#333333'
  },
  yellow: {
    primary: '#ffcc00',
    secondary: '#ffee99',
    background: '#fffdf0',
    text: '#333333'
  },
  purple: {
    primary: '#9900ff',
    secondary: '#cc99ff',
    background: '#f9f0ff',
    text: '#333333'
  }
};

export const useTheme = () => {
  const [currentTheme, setCurrentTheme] = useState<ThemeType>('red');
  
  const toggleTheme = useCallback((theme: ThemeType) => {
    setCurrentTheme(theme);
  }, []);

  return {
    theme: themes[currentTheme],
    toggleTheme,
    currentTheme
  };
};